import 'package:flutter/material.dart';

import 'package:fluro/fluro.dart';

import 'package:logging/logging.dart';


import 'package:xxx_app/constants.dart';

import 'package:xxx_app/src/config/application.dart';
import 'package:xxx_app/src/routes.dart';

final _logger = new Logger('main tabbar');

class HomeScreen extends StatefulWidget {
  @override
  _HomeScreenState createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> with AutomaticKeepAliveClientMixin<HomeScreen> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() { 
      _counter++;
    });
  }

  void showSingin() {

    _logger.finest(" ===== ---- ${AppRoutes.signin_screen}");

    Application.router.navigateTo(context, AppRoutes.signin_screen, transition: TransitionType.inFromBottom);

  }

  @override
  Widget build(BuildContext context) {
    
    return Scaffold(
      appBar: AppBar(

      ),
      body: Container(
        decoration: BoxDecoration(
          color: Color(AppColors.primaryColor),
        ),
        child: new Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            new Container(
              decoration: BoxDecoration(
                // color: Colors.red,
              ),
              child: FlatButton(
                child: Text(
                  "登录",
                ),
                color: Color(AppColors.primaryColor),
                textColor: Colors.white,
                shape: RoundedRectangleBorder(
                  side: BorderSide(
                    color: Colors.white,
                    width: 1,
                  ),
                  borderRadius: BorderRadius.circular(6.0),
                ),
                onPressed: showSingin,

              ),
            ),
            new Text(" home 点击次数: "),
            new Text(
              '$_counter',
              style: Theme.of(context).textTheme.display1,
            ),
          ],
        )
      ),
      floatingActionButton: new FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: new Icon(Icons.add),
      ),
    );
  }

  @override
  bool get wantKeepAlive => true;
  
}

